1. Field of the Invention
One or more aspects of the invention generally relate to computer graphics, and more particularly to texture map data.
2. Description of the Related Art
Conventional graphics processors are exemplified by systems and methods developed to read and filter texture map samples. Conventionally, normalized texture coordinates, such as s, t, and r corresponding to each pixel within a surface, are processed to compute unnormalized texture coordinates, such as u, v, and p. The unnormalized texture coordinates are represented in a fixed point format and are used to determine indices to access texels within a texture map. The normalized texture coordinates are typically represented using a floating point format and are scaled by the size (width or height) of the highest resolution level of detail (LOD) of a mip mapped texture map to produce fixed point format unnormalized texture coordinates.
Traditionally when a video image is used as a texture map it is first resampled to produce an “n×m” dimension texture map where n and m are each a power of two. Specifically, an “n” or “m” that is a power of two may be expressed as n=2i or m=2i, respectively, where i is an integer. Furthermore, to simplify the texture map filtering performed within a graphics processor, the n×m dimension texture map is filtered and various resolutions of the filtered texture are stored as mip mapped texture maps.
FIG. 1A is a conceptual diagram of prior art showing a mip mapped texture including a highest resolution texture map, such as the n×m dimension texture map Texture Map 101. A Texture Map 102, a Texture Map 103, and a Texture Map 104 are successively lower resolution texture maps, mip maps, each storing filtered texels. Each mip map level texture map dimension is half the size of the previous (finer) mip map level texture map dimension, but not less than one. Traditionally texture map dimensions are powers of two in order to simplify computations used to convert from normalized texture coordinates to unnormalized texture coordinates. Specifically, scaling of a normalized texture coordinate by an LOD width or height may be performed using a bit shift instead of a multiply operation. Performing multiplying an integer (LOD width or height) and floating point value, such as a normalized texture coordinate is more difficult than performing multiplying an integer and a fixed point value. Accordingly, it is desirable to convert the normalized texture coordinates to a fixed point format prior to computing the unnormalized texture coordinates by scaling the normalized texture coordinates by an LOD dimension corresponding to a non-power of two texture map.
Furthermore, when an unnormalized texture coordinate lies outside of the texture map, the unnormalized texture coordinate is modified to lie within the texture map according to a wrap mode. Power of two texture maps are also used to simplify computations used to support the wrap modes shown in FIGS. 1B and 1C. FIG. 1B illustrates a texture map applied to a square surface using a “repeat” wrap mode. FIG. 1C illustrates a texture map applied using a “mirror” wrap mode.
Accordingly, there is a need to apply a video image or other non-power of two texture map to a surface using a wrap mode. Furthermore, it is desirable to compute a fixed point normalized texture coordinate that lies within the texture map, i.e., has been wrapped according to the wrap mode, thereby assuring that the normalized texture coordinate that is computed using the unnormalized texture coordinate will also lie within the texture map.